export default{
	data(){
		return{
			modal1:false,
			list:[],
			baseData:[],
			filter:{
				page:1,
				limit:10,
				name:'',
				total:0,
				cate:''
			},
			formValidateCate: {
                title: '',
                id:'',
                type:1,
                parentId:'',
                expand:'true',
                title1: '',//点击结点时后台存储数据，方便增删改调用数据
                id1:'',
                parentId1:''
            }
		} 
	},
	methods:{
		loadmsg(){
			this.$http({
				method:'post',
				url:`http://localhost:3000/${this.module}/list`,
				data:this.filter
			}).then(res=>{
				this.list=res.data.limit;
				this.filter.total=res.data.total;
			})
		},
		changePage(page){
			this.filter.page=page;
			this.loadmsg();
		},
		onPageSizeChange(pageSize){
			this.filter.limit=pageSize;
			this.loadmsg();
		},
		search(){
			this.loadmsg();
		},
		getTree(){//获取数结点的数据
			this.$http({
				url:'http://localhost:3000/cate/list/'+this.formValidateCate.type,
				method:'get'
			}).then(res=>{
				this.baseData=res.data;
			})
		},
		changeSelect(select){//树节点选择时候传出的数据
			this.formValidateCate.title1=select[0].title;
			this.formValidateCate.id1=select[0]._id;
			this.formValidateCate.type1=select[0].type;
			this.formValidateCate.parentId1=select[0].parentId;
		},
        handleSelectAll (status) {//选中所有数据
            this.$refs.selection.selectAll(status);
        },
        getTime(str){
		  	var reg= /([\d\-]+)T(\d+:\d+)\:.*/;
		  	return str.replace(reg, "$1 $2");
		}

	}
}